package com.chanjiedata.changbs.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

/**
 * 屏蔽 滑动事件拦截处理 横向与纵向滚动
 */  
public class MyScrollview extends ScrollView {
    private OnScrollChanged mOnScrollChanged;

    public MyScrollview(Context context) {
        this(context, null);
    }

    public MyScrollview(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyScrollview(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {

    }

    @Override
    protected void onScrollChanged(int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
        super.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY);
        if (mOnScrollChanged != null)
            mOnScrollChanged.onScroll(scrollX, scrollY, oldScrollX, oldScrollY);
    }

    public void setOnScrollChanged(OnScrollChanged onScrollChanged) {
        this.mOnScrollChanged = onScrollChanged;
    }

    public interface OnScrollChanged {
        void onScroll(int scrollX, int scrollY, int oldScrollX, int oldScrollY) ;
    }
}  
